home *** CD-ROM | disk | FTP | other *** search
- // Copyright (C) 1997-2002 Alias|Wavefront,
- // a division of Silicon Graphics Limited.
- //
- // The information in this file is provided for the exclusive use of the
- // licensees of Alias|Wavefront. Such users have the right to use, modify,
- // and incorporate this code into other products for purposes authorized
- // by the Alias|Wavefront license agreement, without fee.
- //
- // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- // PERFORMANCE OF THIS SOFTWARE.
- //
- //
- // Alias|Wavefront Script File
- // MODIFY THIS AT YOUR OWN RISK
- //
- // Creation Date: 2002
- // Author: DRB
- //
- // Description: Create a pond, or fluid with a water surface simulation
- // if it does not exist already, and then create wake and foam emitters for selected objects.
- //
-
- proc string createWakeEmitter(string $wakeFluid, float $wakeIntensity, float $foamIntensity)
- {
- // Create a fluid emitter for the passed in wakeFluid and set the density and temperature
- // emission rates
- string $emitter[] = `fluidEmitter -n "PondWakeEmitter#" -pos 0 0 0 -type volume -vsh sphere -der $wakeIntensity -her $foamIntensity -fer 1 -fdr 2 -r 100.0 -cye none -cyi 1 -mxd 1 -mnd 0 `;
- setAttr ($emitter[0] + ".fluidDropoff") 0.5;
- setAttr ($emitter[0] + ".fluidJitter") 0;
- connectDynamic -em $emitter[0] $wakeFluid;
- if( $foamIntensity > 0.0 ){
- setAttr ($wakeFluid + ".temperatureMethod") 2;
- }
-
- string $emitNotes = ("The following emitter attributes control wake behavior:\n"
- +"Density/Voxel/Sec controls the wake intensity.\n"
- +"Heat/Voxel/Sec controls foam creation if the Temperature Method "
- +"on the pond is set to Dynamic Grid.");
- addAttr -sn nts -ln notes -dt "string" $emitter[0];
- setAttr -type "string" ($emitter[0] + ".notes") $emitNotes;
-
- return($emitter[0]);
- }
-
- global proc createWake( float $wakeIntensity, float $foamIntensity)
- {
- if( !fluidEditLicenseFound() ) {
- error( "Fluid license not found." );
- return;
- }
- string $wakeFluid = getCurrentPond();
- if( $wakeFluid == "" ){
- return;
- }
- // get objects to create wakes for
- string $sel[] = `ls -sl`; // restrict to transforms??
- int $numSel = size($sel);
- int $foundActualBoat = false;
-
- if( $numSel > 0 ){
- for( $i = 0; $i < $numSel; $i++ ){
- string $boatObj = $sel[$i];
- if( isValidBoatObject( $boatObj ) ){
- string $emitter = createWakeEmitter($wakeFluid, $wakeIntensity, $foamIntensity);
- // parent the emitter under the boat
- parent -r $emitter $boatObj;
- $foundActualBoat = true;
-
- }
- }
- }
-
- if(!$foundActualBoat) {
- // create wake without an object if nothing is selected
- createWakeEmitter($wakeFluid, $wakeIntensity, $foamIntensity);
- }
-
- }
-